<?php
include_once "src/controller/regmanagement/MiscellaneousManager.php";
include_once "src/model/Service.php";
include_once "src/regexception/DBConnectionException.php";
include_once "src/regexception/DBException.php";
include_once "src/regexception/GeneralRegistryException.php";
?>
<form dojoType="dijit.form.Form"
      name="searchConsultantForm"
      id="searchConsultantForm"
      method="post">
    <div style="float:left;width:750px;border:1px solid #AAAAAA;background-color:#F2F5F9;padding:10px 10px 10px 10px;font-family:Verdana;font-size:12px;">
        <div style="float:left;font-size:14px;font-weight:bold;width:200px;">
            <div style="float:left;width:30px;text-align:left;">
                <img src="images/icons/numbers_1.png" alt="step1Icon"/>
            </div>
            <div style="float:right;padding-top:3px;">
                Select One Category:
            </div>
        </div>
        <div style="float:left;padding-left:10px;padding-top:3px;width:400px;">
            <input type="radio"
                   dojoType="dijit.form.RadioButton"
                   name="searchIndicator"
                   id="k12Indicator"
                   value="0"
                   onclick="activateSearchConsultantFilterForm();showSearchConsultantFilterOptions();" />
            <label for="k12Indicator"
                   style="padding-right:20px;font-family:Verdana;font-size:14px;font-weight:normal;">K-12</label>
            <input type="radio"
                   dojoType="dijit.form.RadioButton"
                   name="searchIndicator"
                   id="higherEducationIndicator"
                   value="1"
                   onclick="activateSearchConsultantFilterForm();showSearchConsultantFilterOptions();" />
            <label for="higherEducationIndicator"
                   style="font-family:Verdana;font-size:14px;font-weight:normal;">Higher Education</label>
        </div>
    </div>
    <div id="searchConsultantFilterStepTwo"
         style="display:none;float:left;width:750px;border:1px solid #AAAAAA;background-color:#F2F5F9;padding:10px 10px 10px 10px;font-family:Verdana;font-size:12px;margin-top:10px;">
        <div style="float:left;font-size:14px;font-weight:bold;width:500px;">
            <div style="float:left;text-align:left;width:30px;">
                <img src="images/icons/numbers_2.png" alt="step2Icon"/>
            </div>
            <div style="float:left;padding-top:3px;width:250px;">
                Specify your search criteria:
            </div>
        </div>
        <div id="searchConsultantFilterOptions"
             style="float:left;padding-top:10px;width:730px;">
            <div style="float:left;width:300px;">
                <div style="float:left;">
                    <div style="font-weight:bold;padding:0px 0px 3px 0px;">
                        Consultant Name:
                    </div>
                    <div>
                        <input style="width:270px;"
                               type="text"
                               name="consultantName"
                               id="consultantName"
                               value=""
                               dojoType="dijit.form.ValidationTextBox"
                               trim="true"
                               regExp="[\a-zA-Z\.\-\,\' ]+"
                               propercase="true"
                               required="false"
                               disabled="true" />
                    </div>
                </div>
                <div style="float:left;">
                    <div style="font-weight:bold;padding:5px 0px 3px 0px;">
                        Consultant Email:
                    </div>
                    <div>
                        <input style="width:270px;"
                               type="text"
                               name="email"
                               id="email"
                               value=""
                               dojoType="dijit.form.ValidationTextBox"
                               maxLength="50"
                               lowercase="true"
                               regExp="[\a-zA-Z0-9\-\.\_\#]+[\@][a-zA-Z0-9\-\.\_\#]+[\.][a-zA-Z0-9\-\.\_\#]+"
                               trim="true"
                               required="false"
                               disabled="true" />
                    </div>
                </div>
                <div style="float:left;">
                    <div style="font-weight:bold;padding:5px 0px 3px 0px;">
                        Company Name:
                    </div>
                    <div>
                        <input style="width:270px;"
                               type="text"
                               name="companyName"
                               id="companyName"
                               value=""
                               dojoType="dijit.form.ValidationTextBox"
                               trim="true"
                               regExp="[\a-zA-Z\.\-\,\' ]+"
                               propercase="true"
                               required="false"
                               disabled="true" />
                    </div>
                </div>
            </div>
            <div style="float:right;width:420px;">
                <div style="float:left;">
                    <div style="float:left;width:400px;font-weight:bold;padding:0px 0px 0px 0px;">
                        Services Offered:
                        <a href="javascript:showDefineServiceCategoriesDialog();"
                           style="color:#666666;font-size:9px;font-weight:normal;">(Define Categories)</a>
                    </div>
                    <div style="float:left;font-weight:bold;padding:0px 0px 3px 0px;">
                        <div dojoType="dijit.form.DropDownButton"
                             disabled="true"
                             id="selectServicesDialog">
                            <span>Select Service Categories</span>
                            <div dojoType="dijit.TooltipDialog"
                                 title="Services Offered"
                                 execute=""
                                 style="display:none;">
                             <?php
                             try {
                                 $services = MiscellaneousManager::getServices();
                             ?>
                                <div style="font-family:Verdana;font-size:12px;font-weight:bold;">
                                    Select the categories to search for:
                                </div>
                            <?php
                                $servicesSelectedCount = 0;
                                for ($i = 0 ; $i < count($services) ; $i++) {
                                    $service = $services[$i];
                            ?>
                                    <div style="padding-top:5px;">
                                        <input dojotype="dijit.form.CheckBox"
                                               name="tempService<?php echo $i; ?>"
                                               id="tempService<?php echo $i; ?>"
                                               type="checkbox"
                                               value="<?php echo $service->getServiceId(); ?>" />
                                        <label id="serviceName<?php echo $i; ?>"
                                               for="tempService<?php echo $i; ?>"
                                               style="font-family:Verdana;font-size:12px;">
                                                    <?php echo $service->getServiceName(); ?>
                                        </label>
                                    </div>
                            <?php
                                    $servicesSelectedCount = $i + 1;
                                }
                            ?>
                                <div style="text-align:center;padding-top:10px;">
                                    <button dojoType=dijit.form.Button
                                            type="reset"
                                            iconClass="emptyIcon"
                                            onclick="clearSelectedServicesToFilter()">
                                        Clear Selection(s)
                                    </button>
                                    <button dojoType=dijit.form.Button
                                            type="button"
                                            iconClass="emptyIcon"
                                            onclick="addSelectedServicesToFilter()">
                                        Add Selection(s)
                                    </button>
                                </div>
                            <?php
                            } catch (Exception $e) {
                                echo '<div style="font-family:Verdana;font-size:12px;font-weight:bold;">Unable to display Services Offered.</div>';
                            }
                            ?>
                            </div>
                        </div>
                        <input type="hidden"
                               name="servicesSelectedCount"
                               id="servicesSelectedCount"
                               value="<?php echo $servicesSelectedCount; ?>" />
                        <?php
                            for ($i = 0 ; $i < $servicesSelectedCount ; $i++) {
                        ?>
                                <input type="hidden"
                                       name="service<?php echo $i; ?>"
                                       id="service<?php echo $i; ?>"
                                       value="false" />
                        <?php
                            }
                        ?>
                    </div>
                    <div style="float:left;">
                        <div id="selectedServicesListArea"
                             style="float:left;background-color:#EEEEEE;border: 1px solid #999999;width:415px;height:85px;font-size:12px;font-family:Arial;overflow:auto;">

                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div style="float:left;text-align:right;width:730px;">
            <div id="searchConsultantStatusMessage"
                 style="float:left;text-align:left;width:520px;margin-top:7px;">
                
            </div>
            <div style="float:right;text-align:right;padding-top:5px;">
                <input type="hidden"
                       name="pageNumberRequested"
                       value="0" />
                <button dojoType=dijit.form.Button
                        type="reset"
                        name="resetConsultantButton"
                        id="resetConsultantButton"
                        iconClass="emptyIcon"
                        disabled="true"
                        onclick="resetSearchConsultantForm()">
                    Clear Filter
                </button>
                <button dojoType=dijit.form.Button
                        type="button"
                        name="searchConsultantButton"
                        id="searchConsultantButton"
                        iconClass="searchIcon"
                        disabled="true"
                        onclick="submitSearchConsultantForm()">
                    Search
                </button>
            </div>
        </div>
    </div>
</form>